import httpRequest from '../request/index'

export function articleApi () {
  return {
    getArticle: (params) => {
      return httpRequest({
        url: '/articles',
        method: 'get',
        params
      })
    },
    getArticleById: (params) => {
      return httpRequest({
        url: '/articleById',
        method: 'get',
        params
      })
    },
    addArticle: (data) => {
      return httpRequest({
        url: '/article',
        method: 'post',
        timeout: 3 * 60 * 1000,
        data
      })
    },
    updateArticle: (data) => {
      return httpRequest({
        url: '/article',
        method: 'put',
        data
      })
    },
    deleteArticle: (data) => {
      return httpRequest({
        url: '/article',
        method: 'delete',
        data
      })
    },
    getArticleCount: () => {
      return httpRequest({
        url: '/articleCount',
        method: 'get'
      })
    },
    getTypeCount: () => {
      return httpRequest({
        url: '/typeCount',
        method: 'get'
      })
    },
    getMouthCount: () => {
      return httpRequest({
        url: '/articleMouthCount',
        method: 'get'
      })
    }
  }
}
